package com.lujianfei.powerinput.utils;

import android.content.res.AssetManager;
import android.util.Log;

import com.lujianfei.powerinput.MyApplication;

import java.io.InputStream;

class AssetUtils {
    private final static String TAG = "AssetUtils";
    public static String getAssetContent(String filename){
        AssetManager assets = SystemUtils.getApplicationContext().getAssets();
        try {
            InputStream open = assets.open(filename);
            byte[] b = new byte[1024];
            int len;
            StringBuilder sb = new StringBuilder();
            while((len = open.read(b))!=-1){
                sb.append(new String(b,0,len,"UTF-8"));
            }
            return sb.toString();
        } catch (Exception e) {
            Log.e(TAG,""+e);
        }
        return "";
    }
}
